home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / flst200.zip / V7P_SRC.ZIP / BINK.H next >
C/C++ Source or Header  |  1997-05-30  |  45KB  |  1,183 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*              (C) Copyright 1987-96, Bit Bucket Software Co.              */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /*                  Major definitions used in BinkleyTerm                   */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:42/1491                        */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43.  
  44. /*--------------------------------------------------------------------------*/
  45. /* LEGIBLE SECTION.  Definitions to make "C" look like a real language.     */
  46. /*--------------------------------------------------------------------------*/
  47.  
  48. #ifndef BINK_DEFINED
  49. #define BINK_DEFINED
  50.  
  51. #ifndef max
  52. #define max(a,b)     ((a)>(b)?(a):(b))
  53. #endif
  54.  
  55. #ifndef min
  56. #define min(a,b)     ((a)<=(b)?(a):(b))
  57. #endif
  58.  
  59. /*
  60.  * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell.
  61.  *  NOTE: First argument must be in range 0 to 255.
  62.  *        Second argument is referenced twice.
  63.  *
  64.  * Programmers may incorporate any or all code into their programs,
  65.  * giving proper credit within the source. Publication of the
  66.  * source routines is permitted so long as proper credit is given
  67.  * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg,
  68.  * Omen Technology.
  69.  */
  70.  
  71. #define updcrc(cp, crc) ( crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
  72.  
  73. /* We need it the other way around for BinkleyTerm */
  74. #define xcrc(crc,cp) ( crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
  75.  
  76. typedef unsigned bit;
  77. typedef unsigned short word;
  78. typedef unsigned char byte;
  79.  
  80. #define fallthrough
  81.  
  82. #define LOCAL        static
  83. #define empty_str    ""
  84.  
  85. /* The following changes by Greylock Software, to facilitate the MEWEL
  86.  * version of Bink.
  87.  */
  88.  
  89. #define PRDCT_NM(m)     PrdctTbl[m]
  90. #define POLL_POPUP
  91.  
  92. struct _lang_hdr
  93. {
  94.     short ElemCnt;
  95.     short PoolSize;
  96. };
  97.  
  98. struct _key_fnc
  99. {
  100.     short FncIdx;
  101.     short ScanCode;
  102. };
  103.  
  104. struct _key_fnc_hdr
  105. {
  106.     short KeyFncCnt;
  107.     short *KeyFncAry;
  108.     struct _key_fnc *KeyFncTbl;
  109. };
  110.  
  111. #define FA_RDONLY   0x01        /* File is readonly */
  112. #define FA_HIDDEN   0x02        /* File is hidden   */
  113. #define FA_SYSTEM   0x04        /* System file      */
  114. #define FA_VOLID    0x08        /* Volume ID        */
  115. #define FA_SUBDIR   0x10        /* Subdirectory     */
  116. #define FA_ARCH     0x20        /* Archive file     */
  117.  
  118. #if defined(OS_2)
  119. #   define MAXFILENAME CCHMAXPATH
  120. #else
  121. #if defined(_WIN32)
  122. #   define MAXFILENAME MAXPATH
  123. #else
  124. #   define MAXFILENAME 12
  125. #endif
  126. #endif
  127.  
  128. struct FILEINFO
  129. {
  130.     char rsvd[21];
  131.     char attr;
  132.     long time;
  133.     long size;
  134.     char name[MAXFILENAME+1];
  135.     char nill;
  136. };
  137.  
  138. #define DENY_ALL   0
  139. #define DENY_NONE  1
  140. #define DENY_READ  2
  141. #define DENY_RDWR  3
  142. #define DENY_WRITE 4
  143.  
  144. typedef struct pnums
  145. {
  146.     char num[20];
  147.     char pre[20];
  148.     char suf[20];
  149.     short len;
  150.     struct pnums *next;
  151. } PN_TRNS;
  152.  
  153. typedef struct anums
  154. {
  155.     char *num;
  156.     char *alt;
  157.     struct anums *next;
  158. } ANUMS, *P_ANUMS;
  159.  
  160. typedef struct mnums
  161. {
  162.     byte mdm;
  163.     char pre[50];
  164.     char suf[50];
  165.     char ascii[32];
  166.     struct mnums *next;
  167. } MDM_TRNS;
  168.  
  169. /* Used to parse result codes. Filled in by user in BTCONFIG or
  170.    by default in B_INITVA. */
  171.  
  172. struct resp_str
  173. {
  174.     char *resp;
  175.     unsigned disp;
  176. };
  177.  
  178. /* structure of our config statements */
  179. /*
  180. THIS STRUC IS OBSOLETE AND REMOVED! R.Hoerner jan 1997
  181. struct parse_list
  182. {
  183.     char p_length;
  184.     char *p_string;
  185. };
  186.  
  187. */
  188.  
  189. /* Values for try_?_connect, definition in resp_str.disp.          */
  190.  
  191. #define USER_BREAK     -9   /* user pressed ESC                    */
  192. #define WAS_BUSY       -2   /* return "BUSY"                       */
  193. #define WAS_INCOMING   -1   /* either "incoming call" or "cables"  */
  194.  
  195. /* modem results */
  196.  
  197. #define FAILURE     0       /* nothing happened, break             */
  198. #define IGNORE      1       /* nothing important happend, continue */
  199. #define CONNECTED   2       /* CONNECT seen                        */
  200. #define INCOMING    3       /* NO DIALTONE seen when dialing: incoming call */
  201. #define DIALRETRY   4       /* BUSY seen, try alternate number     */
  202. #define RINGING     5       /* RING seen                           */
  203. #define RING        6       /* RINGING seen,                       */
  204. #define COSTRESET   7       /* A string that resets the cost       */
  205. #define FAX        16       /* Fax starts at 16                    */
  206. #define ZYXFAX     17       /* Fax or'ed with 1.                   */
  207. #define FAX_RES1   18
  208. #define FAX_RES2   20
  209. #define FAX_RES3   24       /* last fax response!                  */
  210.  
  211.  
  212. struct modem_commands           /* MR 970325 */
  213. {
  214.   char *init_setup;
  215.   char *init[5];                /* Used to init modem (mailer)      */
  216.   int   init_cnt;               /* MR 970310 multiple init commands */
  217.   char *terminit[5];            /* Used to init modem (terminal)    */
  218.   int   terminit_cnt;           /* MR 970310 multiple init commands */
  219.   char *answer_setup[5];        /* Send before answer is send       */
  220.   int   answer_setup_cnt;       /* MR 970503                        */
  221.   char *answer;                 /* Answer a call                    */
  222.   char *reject;                 /* reject incomming call            */
  223.   char *busy;                   /* Take modem offhook               */
  224.   char *hangup;                 /* Hang Up, do not reset modem!     */
  225.   char *aftercall;              /* Sent to modem after call         */
  226.   char *aftercallout;           /* Sent to modem after reject ???   */
  227.   char *afterconnect;           /* Sent to modem after connect      */
  228.   char *dial_setup;
  229.   char *predial;                /* Pre-dial setup                   */
  230.   char *postdial;               /* Post-dial cleanup                */
  231.   char *normprefix;
  232.   char *normsuffix;
  233. };
  234.  
  235.  
  236. struct prototable
  237. {
  238.     char first_char;
  239.     short entry;
  240. };
  241.  
  242. typedef struct j_types
  243. {
  244.     char j_match[30];
  245.     struct j_types *next;
  246. } J_TYPES, *J_TYPESP;
  247.  
  248. /* mailtypes bit field definitions */
  249. #define MAIL_CRASH     0x0001
  250. #define MAIL_HOLD      0x0002
  251. #define MAIL_DIRECT    0x0004
  252. #define MAIL_NORMAL    0x0008
  253. #define MAIL_REQUEST   0x0010
  254. #define MAIL_WILLGO    0x0020
  255. #define MAIL_TRIED     0x0040
  256. #define MAIL_TOOBAD    0x0080
  257. #define MAIL_UNKNOWN   0x0100
  258. #define MAIL_COST      0x0200
  259. #define MAIL_QSMALL    0x0400
  260. #define MAIL_CANTDIAL  0x0800
  261. #define MAIL_RES1000   0x1000
  262. #define MAIL_RES2000   0x2000
  263. #define MAIL_RES4000   0x4000
  264. #define MAIL_RES8000   0x8000
  265.  
  266. typedef struct finfo
  267. {
  268.     int info_size;
  269.     char curr_fossil;
  270.     char curr_rev;
  271.     char far *id_string;
  272.     unsigned int ibufr; /* TJW 961231 int -> unsigned int */
  273.     unsigned int ifree; /* ""    I hope this is correct!  */
  274.     unsigned int obufr; /* ""                             */
  275.     unsigned int ofree; /* ""                             */
  276.     byte swidth;
  277.     byte sheight;
  278.     char baud;
  279. } FOSINFO;
  280.  
  281. typedef short (*PFI3) (short, short, short, short);
  282.  
  283. typedef struct
  284. {
  285.     unsigned short background;
  286.     unsigned short settings;
  287.     unsigned short history;
  288.     unsigned short hold;
  289.     unsigned short call;
  290.     unsigned short file;
  291.     unsigned short calling;
  292.     unsigned short popup;
  293.     unsigned short headers;  /* TJW 960428 2 more colors - like EE ! */
  294.     unsigned short frames;   /* TJW 960428 2 more colors - like EE ! */
  295.     unsigned short mw_sent;  /* MR 970310 again 2 more colors for modem win */
  296.     unsigned short mw_rcvd;  /* MR 970310 again 2 more colors for modem win */
  297. } SB_COLORS;
  298.  
  299. /*--------------------------------------------------------------------------*/
  300. /* Sealink and Telink header structure                                      */
  301. /*--------------------------------------------------------------------------*/
  302.  
  303. #define HEADER_NAMESIZE  17
  304.  
  305. struct zero_block
  306. {
  307.     long size;                  /* file length                    */
  308.     long time;                  /* file date/time stamp           */
  309.     char name[HEADER_NAMESIZE]; /* original file name             */
  310.     char moi[15];               /* sending program name           */
  311.     char noacks;                /* for SLO                        */
  312. };
  313.  
  314. /*--------------------------------------------------------------------------*/
  315. /* NodeList.Sys                                                             */
  316. /*                                                                          */
  317. /*    NET > 0 and NODE > 0    Normal node                                   */
  318. /*                                                                          */
  319. /*    NET > 0 and NODE <= 0   Host node                                     */
  320. /*                               Net host........node== 0                   */
  321. /*                               Regional host...node==-1                   */
  322. /*                               Country host....node==-2                   */
  323. /*                                                                          */
  324. /*    NET == -1      Nodelist.Sys revision                                  */
  325. /*                                                                          */
  326. /*    NET == -2      Nodelist statement                                     */
  327. /*                                                                          */
  328. /*--------------------------------------------------------------------------*/
  329.  
  330. /*--------------------------------------------------------------------------*/
  331. /* NODE                                                                     */
  332. /* Please note the NewStyle structure (below).  Time is running out for the */
  333. /* existing `_node' structure!  Opus currently uses the old style node      */
  334. /* structure, but not for long.                                             */
  335. /*--------------------------------------------------------------------------*/
  336.  
  337. struct _node
  338. {
  339.     short number;               /* node number                              */
  340.     short net;                  /* net number                               */
  341.     short cost;                 /* cost of a message to this node           */
  342.     short rate;                 /* baud rate                                */
  343.     char name[20];              /* node name                                */
  344.     char phone[40];             /* phone number                             */
  345.     char city[40];              /* city and state                           */
  346. };
  347.  
  348. /*--------------------------------------------------------------------------*/
  349. /* THE NEWSTYLE NODE LIST IS NOW BEING USED BY OPUS 1.10                    */
  350. /*--------------------------------------------------------------------------*/
  351.  
  352. struct _newnode
  353. {
  354.     word NetNumber;
  355.     word NodeNumber;
  356.     word Cost;                  /* cost to user for a message */
  357.     char SystemName[34];        /* node name */
  358.     char PhoneNumber[40];       /* phone number */
  359.     char MiscInfo[30];          /* city and state */
  360.     char Password[8];           /* WARNING: not necessarily null-terminated */
  361.     word RealCost;              /* phone company's charge */
  362.     word HubNode;               /* this node's hub, or point number if a point */
  363.     byte BaudRate;              /* baud rate divided by 300 */
  364.     byte ModemType;             /* RESERVED for modem type */
  365.     word NodeFlags;             /* set of flags (see below) */
  366.     word NodeFiller;
  367. };
  368.  
  369. /*--------------------------------------------------------------------------*/
  370. /* nodex.ndx                                                                */
  371. /*                                                                          */
  372. /* Version 7 Nodelist Index structure.  This is a 512-byte record, which    */
  373. /* is defined by three structures:  Record 0 is the Control Record, then    */
  374. /* some number of Leaf Node (LNode) Records, then the Index Node (INode)    */
  375. /* Records.  This defines an unbalanced binary tree.                        */
  376. /*                                                                          */
  377. /* This description is based on Scott Samet's CBTREE.PAS program.           */
  378. /*                                                                          */
  379. /*--------------------------------------------------------------------------*/
  380.  
  381. struct _ndx
  382. {
  383.     union
  384.     {
  385.         struct _CtlBlk
  386.         {
  387.             word CtlBlkSize;    /* Blocksize of Index Blocks   */
  388.             long CtlRoot;       /* Block number of Root        */
  389.             long CtlHiBlk;      /* Block number of last block  */
  390.             long CtlLoLeaf;     /* Block number of first leaf  */
  391.             long CtlHiLeaf;     /* Block number of last leaf   */
  392.             long CtlFree;       /* Head of freelist            */
  393.             word CtlLvls;       /* Number of index levels      */
  394.             word CtlParity;     /* XOR of above fields         */
  395.         } CtlBlk;
  396.  
  397.         struct _INodeBlk
  398.         {
  399.             long IndxFirst;     /* Pointer to next lower level */
  400.             long IndxBLink;     /* Pointer to previous link    */
  401.             long IndxFLink;     /* Pointer to next link        */
  402.             short IndxCnt;      /* Count of Items in block     */
  403.             word IndxStr;       /* Offset in block of 1st str  */
  404.  
  405.             /* If IndxFirst is NOT -1, this is INode:          */
  406.  
  407.             struct _IndxRef
  408.             {
  409.                 word IndxOfs;   /* Offset of string into block */
  410.                 word IndxLen;   /* Length of string            */
  411.                 long IndxData;  /* Record number of string     */
  412.                 long IndxPtr;   /* Block number of lower index */
  413.             } IndxRef[20];
  414.         } INodeBlk;
  415.  
  416.         struct _LNodeBlk
  417.         {
  418.             /* IndxFirst is -1 in LNodes   */
  419.  
  420.             long IndxFirst;     /* Pointer to next lower level */
  421.             long IndxBLink;     /* Pointer to previous link    */
  422.             long IndxFLink;     /* Pointer to next link        */
  423.             short IndxCnt;      /* Count of Items in block     */
  424.             word IndxStr;       /* Offset in block of 1st str  */
  425.             struct _LeafRef
  426.             {
  427.                 word KeyOfs;    /* Offset of string into block */
  428.                 word KeyLen;    /* Length of string            */
  429.                 long KeyVal;    /* Pointer to data block       */
  430.             } LeafRef[30];
  431.         } LNodeBlk;
  432.  
  433.         char RawNdx[512];
  434.  
  435.     } ndx;
  436. };
  437.  
  438. /*--------------------------------------------------------------------------*/
  439. /*                                                                          */
  440. /* OPUS 1.20 Version 7 Nodelist structure. Copyright 1991 Wynn Wagner III   */
  441. /* and Doug Boone. Used by permission.                                      */
  442. /*                                                                          */
  443. /*--------------------------------------------------------------------------*/
  444.  
  445. struct _vers7
  446. {
  447.     short Zone;
  448.     short Net;
  449.     short Node;
  450.     short HubNode;              /* If a point, this is point number. */
  451.     word CallCost;              /* phone company's charge */
  452.     word MsgFee;                /* Amount charged to user for a message */
  453.     word NodeFlags;             /* set of flags (see below) */
  454.     byte ModemType;             /* RESERVED for modem type */
  455.     byte Phone_len;
  456.     byte Password_len;
  457.     byte Bname_len;
  458.     byte Sname_len;
  459.     byte Cname_len;
  460.     byte pack_len;
  461.     byte BaudRate;              /* baud rate divided by 300 */
  462. };
  463.  
  464. /*--------------------------------------------------------------------------*/
  465. /* Values for the `NodeFlags' field                                         */
  466. /*--------------------------------------------------------------------------*/
  467.  
  468. #define B_hub    0x0001     /* node is a net hub        0000 0000 0000 0001 */
  469. #define B_host   0x0002     /* node is a net host       0000 0000 0000 0010 */
  470. #define B_region 0x0004     /* node is region coord     0000 0000 0000 0100 */
  471. #define B_zone   0x0008     /* is a zone gateway        0000 0000 0000 1000 */
  472. #define B_CM     0x0010     /* runs continuous mail     0000 0000 0001 0000 */
  473. #define B_res1   0x0020     /* reserved by Opus         0000 0000 0010 0000 */
  474. #define B_res2   0x0040     /* reserved by Opus         0000 0000 0100 0000 */
  475. #define B_res3   0x0080     /* reserved by Opus         0000 0000 1000 0000 */
  476. #define B_res4   0x0100     /* reserved by Opus         0000 0001 0000 0000 */
  477. #define B_res5   0x0200     /* reserved for non-Opus    0000 0010 0000 0000 */
  478. #define B_res6   0x0400     /* reserved for non-Opus    0000 0100 0000 0000 */
  479. #define B_res7   0x0800     /* reserved for non-Opus    0000 1000 0000 0000 */
  480. #define B_point  0x1000     /* node is a point          0001 0000 0000 0000 */
  481. #define B_res9   0x2000     /* reserved for non-Opus    0010 0000 0000 0000 */
  482. #define B_resa   0x4000     /* reserved for non-Opus    0100 0000 0000 0000 */
  483. #define B_resb   0x8000     /* reserved for non-Opus    1000 0000 0000 0000 */
  484.  
  485.  
  486. // nodex.dtp (v7+)
  487.  
  488. typedef unsigned long dword;
  489.  
  490. typedef struct _DTPCtl{
  491.   word size;       // Size of this control structure
  492.   byte version;    // Version of DTP file
  493.   byte AllFixSize; // sizeof(_DTPAllLnk)
  494.   byte AddFixSize; // sizeof(_DTPNodeLnk)
  495. } DTPCTL;
  496.  
  497. typedef struct _DTPAllLnk{
  498.   word Region;    // Region, 0 if none
  499.   word Hub;       // Hub, 0 if none
  500.   dword SOfs;     // DAT offset of next Same Sysop entry, 0xffffffff if none
  501.   dword POfs;     // DAT offset of next Same Phone entry, 0xffffffff if none 
  502.   dword FeOfs;    // DAT offset of next "Equal Fido Level" entry, 0xffffffff if none 
  503.   byte Sn;        // Number (0 based) of Sysop entry (ADR order)
  504.   byte Pn;        // Number (0 based) of Phone entry (ADR order)
  505. } DTPALLLNK;
  506.  
  507. typedef struct _DTPNodeLnk{
  508.   word ndowns;  // number of system in lower level ("downlinks")
  509.   dword FlOfs;  // DAT offset of "Lower Fido Level" - first "downlink"
  510. } DTPNODELNK;
  511.  
  512. typedef struct{
  513.   DTPCTL     control;
  514.   DTPNODELNK TopLink;
  515. } DTPHEADER;
  516.  
  517. /*--------------------------------------------------------------------------*/
  518. /* Nodelist.Idx                                                             */
  519. /* (File is terminated by EOF)                                              */
  520. /*--------------------------------------------------------------------------*/
  521.  
  522. struct _ndi
  523. {
  524.     short node;             /* node number  */
  525.     short net;              /* net number   */
  526. };
  527.  
  528. /*--------------------------------------------------------------------------*/
  529. /* QuickBBS 2.00 QNL_IDX.BBS                                                */
  530. /* (File is terminated by EOF)                                              */
  531. /*--------------------------------------------------------------------------*/
  532.  
  533. struct QuickNodeIdxRecord
  534. {
  535.     unsigned short QI_Zone;
  536.     unsigned short QI_Net;
  537.     unsigned short QI_Node;
  538.     byte QI_NodeType;
  539. };
  540.  
  541. /*--------------------------------------------------------------------------*/
  542. /* QuickBBS 2.00 QNL_DAT.BBS                                                */
  543. /* (File is terminated by EOF)                                              */
  544. /*--------------------------------------------------------------------------*/
  545.  
  546. struct QuickNodeListRecord
  547. {
  548.     byte QL_NodeType;
  549.     unsigned short QL_Zone;
  550.     unsigned short QL_Net;
  551.     unsigned short QL_Node;
  552.     char QL_Name[21];           /* Pascal! 1 byte count, up to 20 chars */
  553.     char QL_City[41];           /* 1 + 40 */
  554.     char QL_Phone[41];          /* 1 + 40 */
  555.     char QL_Password[9];        /* 1 + 8 */
  556.     word QL_Flags;              /* Same as flags in new nodelist structure */
  557.     word QL_BaudRate;
  558.     word QL_Cost;
  559. };
  560.  
  561. /* SEAdog NETLIST.DOG format */
  562.  
  563. struct netls
  564. {
  565.     short netnum;
  566.     char netname[14];
  567.     char netcity[40];
  568.     short havehost;
  569.     short nethost;
  570.     short havegate;
  571.     short netgate;
  572.     long nodeptr;
  573.     short numnodes;
  574. };
  575.  
  576. /* SEAdog NODELIST.DOG format */
  577.  
  578. struct nodels
  579. {
  580.     short nodenum;
  581.     char nodename[14];
  582.     char nodecity[40];
  583.     char nodephone[40];
  584.     short havehub;
  585.     short nodehub;
  586.     short nodecost;
  587.     short nodebaud;
  588. };
  589.  
  590. /* Things most nodelists don't contain, but Binkley likes to have */
  591.  
  592. struct extrastuff
  593. {
  594.     char password[8];
  595.     unsigned short flags1;
  596.     byte modem;
  597.     char extra[5];              /* for future expansion */
  598. };
  599.  
  600. /* Format of a XMODEM block */
  601.  
  602. typedef struct
  603. {
  604.     unsigned char header;
  605.     unsigned char block_num;
  606.     unsigned char block_num_comp;
  607.     unsigned char data_bytes[128];
  608.     unsigned char data_check[2];
  609. } XMDATA, *XMDATAP;
  610.  
  611. /* Format of Telink block 0 */
  612.  
  613. typedef struct
  614. {
  615.     unsigned char header;
  616.     unsigned char block_num;
  617.     unsigned char block_num_comp;
  618.     long filelength;
  619.     union
  620.     {
  621.         struct
  622.         {
  623.             unsigned short time;
  624.             unsigned short date;
  625.         } twowords;
  626.  
  627.         struct
  628.         {
  629.             unsigned long timedate;
  630.         } oneword;
  631.     } filetime;
  632.     char filename[16];
  633.     char nullbyte;
  634.     char sendingprog[15];
  635.     char noacks;
  636.     unsigned char crcmode;
  637.     char fill[86];
  638.     unsigned char data_check[2];
  639. } TLDATA, *TLDATAP;
  640.  
  641. /* Format of SEAlink block 0 */
  642.  
  643. typedef struct
  644. {
  645.     unsigned char header;
  646.     unsigned char block_num;
  647.     unsigned char block_num_comp;
  648.     long filelength;
  649.     unsigned long timedate;
  650.     char filename[17];
  651.     char sendingprog[15];
  652.     char SLO;
  653.     char Resync;
  654.     char MACFLOW;
  655.     char fill[85];
  656.     unsigned char data_check[2];
  657. } SEADATA, *SEADATAP;
  658.  
  659. typedef struct
  660. {
  661.     unsigned int SEAlink:1;     /* Can do SEAlink */
  662.     unsigned int SLO:1;         /* Can do SEAlink with Overdrive */
  663.     unsigned int Resync:1;      /* Can do SEAlink with Resync */
  664.     unsigned int MacFlow:1;     /* Can do SEAlink with Macintosh flow control */
  665.     unsigned int do_CRC:1;      /* Should do CRC instead of checksum */
  666.     unsigned int TeLink:1;      /* We saw a TeLink header */
  667. } TRANS, *TRANSP;
  668.  
  669. typedef struct
  670. {
  671.     char *state_name;
  672.     short (*state_func) (void *);
  673. } STATES, *STATEP;
  674.  
  675. typedef struct
  676. {
  677.     long control;               /* We will always have a long on top */
  678.     long filler;                /* Just to be sure. Min size, 8 bytes*/
  679. } STATEBASE, *STATEBASEP;
  680.  
  681. typedef struct
  682. {
  683.     long control;               /* These must always start with a long! */
  684.     TRANS options;              /* Transfer options */
  685.     short result;               /* Result from last operation */
  686.     short sub_results;          /* Extra result codes */
  687.     long T1;                    /* General purpose timer */
  688.     long T2;                    /* General purpose timer */
  689.     short Window;               /* SEAlink window size */
  690.     long SendBLK;               /* Current block to be sent */
  691.     long NextBLK;               /* Next block we will try to send */
  692.     long ACKBLK;                /* Block that was last ACK'd */
  693.     long LastBlk;               /* Last block in file */
  694.     long ARBLK;                 /* Used in ACK Check calculations */
  695.     long WriteBLK;              /* Block number to write to file */
  696.     long filelen;               /* Length of file being sent */
  697.     long curr_byte;             /* Current byte offset of sending or receiving */
  698.     long prev_bytes;            /* Bytes that we are resyncing over */
  699.     long total_blocks;          /* Total number of blocks in file to be received */
  700.     long resync_block;          /* Block number we received to resync to */
  701.     short NumNAK;               /* Number of NAK's received this block */
  702.     short ACKsRcvd;             /* Number of ACK's received since file start */
  703.     short ACKST;                /* Current state of the ack/nak state variable */
  704.     short tries;                /* Number of tries thus far */
  705.     short goodfile;             /* 0 if file was bad, 1 if file was good */
  706.     short datalen;              /* Length of data in this block */
  707.     short recblock;             /* Block number received */
  708.     short sent_ACK;             /* Whether or not we sent an ACK already */
  709.     short tot_errs;             /* Total number of errors */
  710.     unsigned char ARBLK8;       /* 8 bit value of ARBLK */
  711.     unsigned char blocknum;     /* 8 bit value of SendBLK */
  712.     unsigned char check;        /* checksum value */
  713.     unsigned char save_header;  /* Received header from first block */
  714.     short CHR;                  /* General purpose receive character */
  715.     union                       /* File date and time in Telink or SEAlink format */
  716.     {
  717.         struct
  718.         {
  719.             unsigned short time;
  720.             unsigned short date;
  721.         } twowords;
  722.  
  723.         struct
  724.         {
  725.             unsigned long timedate;
  726.         } oneword;
  727.     }
  728.     save_filetime;
  729.     char received_name[20];     /* Received filename from Telink or SEAlink */
  730.     char m7name[12];            /* Filename in Modem7 format */
  731.     char sending_program[16];   /* Sending program name                    */
  732.     char *filename;             /* The filename to be sent or received */
  733.     char *path;                 /* Just the path to the file to be sent/received */
  734.     char *fptr;                 /* Pointer into character fields */
  735.     char *temp_name;            /* Temporary name for receiving */
  736.     FILE *file_pointer;         /* The pointer for read/write/seek operations */
  737.  
  738.     unsigned char header;
  739.     unsigned char block_num;
  740.     unsigned char block_num_comp;
  741.     unsigned char data[128];
  742.     unsigned char data_check[2];
  743. } XMARGS, *XMARGSP;
  744.  
  745. #define DID_RESYNC 1
  746.  
  747. typedef struct
  748. {
  749.     long control;               /* These must always start with a long! */
  750.     short tries;
  751.     short barklen;
  752.     short barkok;
  753.     long T1;
  754.     short nfiles;
  755.     char *inbound;
  756.     char *filename;
  757.     char barkpacket[128];
  758.     char *barkpw;
  759.     char *barktime;
  760. } BARKARGS, *BARKARGSP;
  761.  
  762. /*--------------------------------------------------------------------------*/
  763. /* FIDONET ADDRESS STRUCTURE                                                */
  764. /*--------------------------------------------------------------------------*/
  765.  
  766. typedef struct _ADDRESS
  767. {
  768.     word Zone;
  769.     word Net;
  770.     word Node;
  771.     word Point;
  772.     char *Domain;
  773. } ADDR, *ADDRP;
  774.  
  775. typedef struct _DOMAINKLUDGE
  776. {
  777.     word zone;
  778.     word domain;
  779. } DOMAINKLUDGE;
  780.  
  781. typedef struct mail
  782. {
  783.     ADDR mail_addr;             /* Addressee */
  784.     unsigned short numfiles;    /* Total number of packets and files      */
  785.     unsigned short mailtypes;   /* Bitmask of types we have for addressee */
  786.     unsigned long mailsize;     /* Total amount of mail for addressee     */
  787.     unsigned long req_size;     /* Amount of mail that is requests        */
  788.     unsigned long callsize;     /* Amount of mail that isn't on hold      */
  789.     unsigned long oldest;       /* time_t of oldest mail                  */
  790.     struct mail *next;
  791.     struct mail *prev;
  792. } MAIL, *MAILP;
  793.  
  794. typedef struct dumpmail       /* TJW 960721 struct dumped to btrescan.dmp */
  795. {
  796.    MAIL mail;
  797.    char Domain[8];
  798. } DUMPMAIL, *DUMPMAILP;
  799.  
  800. typedef int (*nfunc) (ADDR *, int);
  801. typedef void (*ufunc) (char *, ADDR *);
  802.  
  803. #define MAX_EXTERN  8
  804.  
  805. #define ALIAS_CNT   100    /* CE 960413 (was 25) */
  806. #define DOMAINS     50    /* r. hoerner 1/6/97 */
  807.  
  808. /*--------------------------------------------------------------------------*/
  809. /* Matrix mask                                                              */
  810. /* Undefined bits are reserved by Opus                                      */
  811. /*--------------------------------------------------------------------------*/
  812.  
  813. #define NO_TRAFFIC  0x0001
  814. #define LOCAL_ONLY  0x0002
  815. #define OPUS_ONLY   0x0004
  816.  
  817. #define NO_EXITS    0x2000
  818. #define MAIL_ONLY   0x4000
  819. #define TAKE_REQ    0x8000
  820.  
  821. /*--------------------------------------------------------------------------*/
  822. /* Message packet header                                                    */
  823. /*--------------------------------------------------------------------------*/
  824.  
  825. #define PKTVER  2
  826.  
  827. /*--------------------------------------------*/
  828. /* POSSIBLE VALUES FOR `product' (below)      */
  829. /*                                            */
  830. /* NOTE: These product codes are assigned by  */
  831. /* the FidoNet<tm> Technical Stardards Com-   */
  832. /* mittee.  If you are writing a program that */
  833. /* builds packets, you will need a product    */
  834. /* code.  Please use ZERO until you get your  */
  835. /* own.  For more information on codes, write */
  836. /* to FTSC at 115/333.                        */
  837. /*                                            */
  838. /*--------------------------------------------*/
  839.  
  840. #define isFIDO      0
  841. #define isANXCLO    4
  842. #define isOPUS      5
  843. #define isIGOR      65
  844. #define isTIMS      66
  845. #define isBITBRAIN  0x1b
  846. #define isDBRIDGE   0x1d
  847. #define isMILQUE    0xac
  848.  
  849. #ifndef PRDCT_CODE
  850. #define PRDCT_CODE      isBITBRAIN
  851. #endif
  852.  
  853. #ifndef PRDCT_MAJOR
  854. #define PRDCT_MAJOR     2
  855. #endif
  856.  
  857. #ifndef PRDCT_MINOR
  858. #define PRDCT_MINOR     60
  859. #endif
  860.  
  861. #ifndef PRDCT_PRFX
  862. #define PRDCT_PRFX      "BINKLEY"
  863. #endif
  864.  
  865. #ifndef PRDCT_PRTY
  866. #define PRDCT_PRTY      "BinkleyTerm"
  867. #endif
  868.  
  869. #ifndef PRD_SH_PRTY
  870. #  if defined OS_2
  871. #    define PRD_SH_PRTY     "BT-OS/2"
  872. #  elif defined _WIN32
  873. #    define PRD_SH_PRTY     "BT/Win32"
  874. #  else
  875. #    define PRD_SH_PRTY     "BT"
  876. #  endif
  877. #endif
  878.  
  879. #ifndef PRDCT_SHRT
  880. #define PRDCT_SHRT      "Bink"
  881. #endif
  882.  
  883. #ifndef PRDCT_VRSN
  884. #define PRDCT_VRSN              "2.60XE" /* TJW 960413 */
  885. #endif
  886.  
  887. struct _pkthdr
  888. {
  889.     short orig_node;        /* originating node               */
  890.     short dest_node;        /* destination node               */
  891.     short year;             /* 0..99  when packet was created */
  892.     short month;            /* 0..11  when packet was created */
  893.     short day;              /* 1..31  when packet was created */
  894.     short hour;             /* 0..23  when packet was created */
  895.     short minute;           /* 0..59  when packet was created */
  896.     short second;           /* 0..59  when packet was created */
  897.     short rate;             /* destination's baud rate        */
  898.     short ver;              /* packet version, must be 2      */
  899.     short orig_net;         /* originating network number     */
  900.     short dest_net;         /* destination network number     */
  901.     char product;           /* product type                   */
  902.     char serial;            /* serial number (some systems)   */
  903.  
  904.     byte password[8];       /* session/pickup password        */
  905.     short orig_zone;        /* originating zone               */
  906.     short dest_zone;        /* Destination zone               */
  907.     byte B_fill2[16];
  908.     long B_fill3;
  909. };
  910.  
  911. struct _pkthdr45            /* FSC-0045 (2.2) packet type     */
  912. {
  913.     short orig_node;        /* originating node               */
  914.     short dest_node;        /* destination node               */
  915.     short orig_point;       /* originating point              */
  916.     short dest_point;       /* destination point              */
  917.     byte b_fill1[8];        /* Unused, must be zero           */
  918.     short subver;           /* packet subversion, must be 2   */
  919.     short ver;              /* packet version, must be 2      */
  920.     short orig_net;         /* originating network number     */
  921.     short dest_net;         /* destination network number     */
  922.     char product;           /* product type                   */
  923.     char serial;            /* serial number (some systems)   */
  924.  
  925.     byte password[8];       /* session/pickup password        */
  926.     short orig_zone;        /* originating zone               */
  927.     short dest_zone;        /* Destination zone               */
  928.     byte orig_domain[8];    /* originating domain             */
  929.     byte dest_domain[8];    /* destination domain             */
  930.     long B_fill3;
  931. };
  932.  
  933. struct _pkthdr39            /* FSC-0039 packet type           */
  934. {
  935.     short orig_node;        /* originating node               */
  936.     short dest_node;        /* destination node               */
  937.     short year;             /* 0..99  when packet was created */
  938.     short month;            /* 0..11  when packet was created */
  939.     short day;              /* 1..31  when packet was created */
  940.     short hour;             /* 0..23  when packet was created */
  941.     short minute;           /* 0..59  when packet was created */
  942.     short second;           /* 0..59  when packet was created */
  943.     short rate;             /* destination's baud rate        */
  944.     short ver;              /* packet version, must be 2      */
  945.     short orig_net;         /* originating network number     */
  946.     short dest_net;         /* destination network number     */
  947.     byte product_low;       /* FTSC product type (low byte)   */
  948.     byte prod_rev_low;      /* product rev (low byte)         */
  949.  
  950.     byte password[8];       /* session/pickup password        */
  951.     short zone_ignore[2];   /* Zone info from other software  */
  952.     byte B_fill1[2];
  953.     short CapValid;         /* CapWord with bytes swapped.    */
  954.     byte product_hi;        /* FTSC product type (high byte)  */
  955.     byte prod_rev_hi;       /* product rev (hi byte)          */
  956.     short CapWord;          /* Capability word                */
  957.     short orig_zone;        /* originating zone               */
  958.     short dest_zone;        /* Destination zone               */
  959.     short orig_point;       /* originating point              */
  960.     short dest_point;       /* destination point              */
  961.     long ProdData;          /* Product-specific data          */
  962. };
  963.  
  964. /*--------------------------------------------------------------------------*/
  965. /* WaZOO                                                                    */
  966. /*--------------------------------------------------------------------------*/
  967.  
  968. #ifndef ACK
  969. #define ACK    0x06
  970. #endif
  971.  
  972. #ifndef NAK
  973. #define NAK    0x15
  974. #endif
  975.  
  976. #ifndef ENQ
  977. #define ENQ    0x05
  978. #endif
  979.  
  980. #ifndef YOOHOO
  981. #define YOOHOO 0x00f1
  982. #endif
  983.  
  984. #ifndef  TSYNC
  985. #define  TSYNC 0x00ae
  986. #endif
  987.  
  988. struct _Hello
  989. {
  990.     word signal;            /* always 'o'     (0x6f)                   */
  991.     word hello_version;     /* currently 1    (0x01)                   */
  992.     word product;           /* product code                            */
  993.     word product_maj;       /* major revision of the product           */
  994.     word product_min;       /* minor revision of the product           */
  995.     char my_name[60];       /* Other end's name                        */
  996.     char sysop[20];         /* sysop's name                            */
  997.     word my_zone;           /* 0== not supported                       */
  998.     word my_net;            /* out primary net number                  */
  999.     word my_node;           /* our primary node number                 */
  1000.     word my_point;          /* 0== not supported                       */
  1001.     byte my_password[8];    /* ALL 8 CHARACTERS ARE SIGNIFICANT !!!!!  */
  1002.     byte reserved2[8];      /* reserved by Opus                        */
  1003.     word capabilities;      /* see below                               */
  1004.     byte reserved3[12];     /* available to non-Opus                   */
  1005.                             /* systems by prior "approval" of 124/108. */
  1006. };                          /* size 128 bytes */
  1007.  
  1008. /*--------------------------------------------------------------------------*/
  1009. /* YOOHOO<tm> CAPABILITY VALUES                                             */
  1010. /*--------------------------------------------------------------------------*/
  1011.  
  1012. #define Y_DIETIFNA  0x0001
  1013. #define FTB_USER    0x0002
  1014. #define ZED_ZIPPER  0x0004
  1015. #define ZED_ZAPPER  0x0008
  1016. #define DOES_IANUS  0x0010
  1017. #define DOES_HYDRA  0x0020
  1018. #define Bit_6       0x0040
  1019. #define Bit_7       0x0080
  1020. #define Bit_8       0x0100
  1021. #define Bit_9       0x0200
  1022. #define Bit_a       0x0400
  1023. #define Bit_b       0x0800
  1024. #define Bit_c       0x1000
  1025. #define Bit_d       0x2000
  1026. #define DO_DOMAIN   0x4000
  1027. #define WZ_FREQ     0x8000
  1028.  
  1029. /*--------------------------------------------------------------------------*/
  1030. /* EMSI                                                                     */
  1031. /*--------------------------------------------------------------------------*/
  1032.  
  1033. /* Indexes into the emsistr array for use by EMSI parsing */
  1034.  
  1035. #define EMSI_REQ   0
  1036. #define EMSI_DAT   1
  1037. #define EMSI_HBT   2
  1038. #define EMSI_NAK   3
  1039. #define EMSI_ACK   4
  1040. #define EMSI_INQ   5
  1041. #define EMSI_CLI   6
  1042.  
  1043. #define EMSI_LEN   14     /* longest emsi string */
  1044. #define EMSI_MAX   6      /* highest emsi string */
  1045.  
  1046. /*--------------------------------------------------------------------------*/
  1047. /* TJW 960505 PRIORITY CONSTANTS for set_prior(priority)                     */
  1048. /*--------------------------------------------------------------------------*/
  1049.  
  1050. #define PRIO_REGULAR 2
  1051. #define PRIO_JANUS   3
  1052. #define PRIO_MODEM   4
  1053. #define PRIO_HYDRA   5
  1054.  
  1055. /* ------------------------------------ */
  1056. /* TE 960518 TYPE OF FILE REQUEST INDEX */
  1057. /* ------------------------------------ */
  1058.  
  1059. #define FRI_MAXIMUS  0
  1060. #define FRI_PROBOARD 1
  1061.  
  1062. #define E_INPUT_LEN 512       /* TJW 960708 size of array e_input[] */
  1063.  
  1064. #endif              /* BINK_DEFINED */
  1065.  
  1066. /* END OF FILE: bink.h */
  1067.  
  1068. /* ----------------------------- */
  1069. /* CFS 961020 STRING REPLACEMENT */
  1070. /* ----------------------------- */
  1071. struct SStringRep
  1072. {
  1073.     char *change;
  1074.     char *replacement;
  1075.     int frommodem;
  1076. };
  1077.  
  1078. /* R. Hoerner, possible flags for NODESTRUC */
  1079. #define NOEMSI   0x0001 /* "NoEMSI <nodenumber>"     OUTBOUND CALLS    */
  1080. #define NOWAZOO  0x0002 /* "NoWazoo <nodenumber>"    OUTBOUND CALLS    */
  1081. #define NOHYDRA  0x0004 /* "NoHydra <nodenumber>"    IN/OUTBOUND CALLS */
  1082. #define NOJANUS  0x0008 /* "NoJanus <nodenumber>"    IN/OUTBOUND CALLS */
  1083. #define NOREQ    0x0010 /* "NoReqests <nodenumber>"  INBOUND     CALLS */
  1084. #define NODIET   0x0020 /* "NoDietIFNA <nodenumber>" OUTBOUND CALLS    */
  1085. #define FREEREQ  0x0040 /* "ReqOnUs <nodenumber>"    IN/OUTBOUND CALLS */
  1086. #define NOZED    0x0080 /* "NoZedZap <nodenumber>"   IN/OUTBOUND CALLS */
  1087. #define NOSEA    0x0100 /* "NoSeaLink <nodenumber>"  IN/OUTBOUND CALLS */
  1088. #define NOPICK   0x0200 /* "NoPickup <nodenumber>"   IN/OUTBOUND CALLS */
  1089. #define NOHYCHAT 0x0400 /* "NoHydraChat <nodenumber>"IN/OUTBOUND CALLS */
  1090. #define DO_BELL  0x0800 /* "Gong <nodenumber>"        node x calls: bimmeling */
  1091. #define NOJOKERS 0x1000 /* "NoWildCards <nodenumber>" node may not freq "*.*" */
  1092. #define FREEPOLL 0x2000 /* "FreePoll <nodenumber>"   IN/OUTBOUND CALLS */
  1093. #define CALLBACK 0x4000 /* "CallBack <nodenumber>"   INBOUND CALLS */
  1094. #define TIMESYNC 0x8000 /* "TimeSync <nodenumber>"   IN/OUTBOUND CALLS */
  1095.  
  1096. #define AT_NETMAIL   1
  1097. #define AT_ECHOMAIL  2
  1098. #define AT_OTHER     4
  1099.  
  1100. /* MR 970311 moved some parts to NODESTRUC, access via NODESTRUC */
  1101.  
  1102. typedef struct _FP              /* CE 15.04.96 Configline for FreePoll */
  1103. {
  1104.     long   Size;                /* limit in KB */
  1105.     time_t Delta_T;             /* max delta time for freepoll override */
  1106.     short  AttachType;          /* Bit-mapped struct - CFS 970504 */
  1107.     int    and_op;              /* =1 -> AND op, =0 -> OR op */
  1108.     struct _FP *next;
  1109. } FP, *FPP;
  1110.  
  1111. typedef struct _CIDLST
  1112. {
  1113.     char           *CallerID;
  1114.     struct _CIDLST *next;
  1115. } CIDLST, *CIDLSTP;
  1116.  
  1117. /* ----------------------------------------------------------------------*/
  1118. /* Address structure for linked list of remote nodes (unlimited!)        */
  1119. /* ----------------------------------------------------------------------*/
  1120. typedef struct _NODESTRUC{
  1121.     ADDR                addr;                               /* MR 970314 */
  1122.     CIDLSTP             CallerIDList;                  /* caller ID list */
  1123.     long                Flags;
  1124.     FPP                 FPoll;
  1125.     char *ExtraDir;             /* *MUST* be backslash-terminated */
  1126.     struct _NODESTRUC  *next;
  1127. } NODESTRUC,*PNODESTRUC;
  1128. /* ----------------------------------------------------------------------*/
  1129. /* Address structure for linked list of AKAS (unlimited AKAs!)           */
  1130. /* ----------------------------------------------------------------------*/
  1131. typedef struct _AKA{
  1132.     word Zone;
  1133.     word Net;
  1134.     word Node;
  1135.     word Point;
  1136.     char *Domain;
  1137.     struct _AKA *next;
  1138. } AKA,*PAKA;
  1139. /* ----------------------------------------------------------------------*/
  1140. /* structure for linked list of overrides                                */
  1141. /* ----------------------------------------------------------------------*/
  1142. typedef struct _phones{
  1143.     word Zone;
  1144.     word Net;
  1145.     word Node;
  1146.     word Point;
  1147.     char *Domain;
  1148.     char *num;
  1149.     word modem;
  1150.     word fido;
  1151.     struct _phones *next;
  1152. } PHONE,*PPHONE;
  1153. /* ----------------------------------------------------------------------*/
  1154. /* structure for reports to PKT - CFS 970209                             */
  1155. /* ----------------------------------------------------------------------*/
  1156. typedef struct _pktrep
  1157. {
  1158.     ADDR from,to;
  1159.     int  toecho;
  1160.     char echo[65];
  1161.     char password[9];
  1162. } PKTREP,*PPKTREP;
  1163.  
  1164. /* error values for config / event file parsers */
  1165. typedef enum _keyword_errors
  1166. {
  1167.     kwd_ok,
  1168.     kwd_bad,
  1169.     kwd_unknown,
  1170.     kwd_nomem,
  1171.     kwd_other_err
  1172. } KWD_ERR;
  1173.  
  1174. /* error values for mailer sessions */
  1175. typedef enum _mailsession_errors
  1176. {
  1177.     mission_ok,
  1178.     mission_error,
  1179.     mission_aborted,
  1180.     mission_timeout
  1181. } MISSION_ERR;
  1182.  
  1183.